package org.myrpc.utils;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import com.caucho.hessian.io.HessianInput;
import com.caucho.hessian.io.HessianOutput;

public class CloseUtils {
	 InputStream in = null;   
	 HessianInput hessianInput = null;   
	 OutputStream out = null;  
	 HessianOutput hessianOutput = null; 
	 
	 public static void close(InputStream in, HessianInput hessianInput, OutputStream out,HessianOutput hessianOutput) {
		 if (in != null) {     
			 try {        
				 in.close();       
			 } catch (IOException e) {          
					 e.printStackTrace();     
					 in = null;        
			 	}    
		 	}
		 
		 
		 if (out != null) {       
			 try {           
				 out.close();         
				 } catch (IOException e) {         
					 e.printStackTrace();         
					 out = null;        
					 }      
		 	}
		 
		 if (hessianInput != null) {      
			 hessianInput.close();    
		 	}     
		 
		 
		 if (hessianOutput != null) {     
			 try {             
				 hessianOutput.close();      
				 } catch (IOException e) {      
					 e.printStackTrace();      
					 hessianOutput = null;   
				 }     
			 }
	 }
	 
	 

}
